<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<style type="text/css">
    #allmap {
        width: 400px;
        height: 400px;
        overflow: hidden;
        margin: 0;
        font-family: "微软雅黑";
    }
</style>
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=Cxe9bR6pGdptKm59nVgtG14psfMtNUR5"></script>
<form action="week-add" enctype="multipart/form-data" method="post">
    {{ csrf_field() }}
    <div class="form-group">
        <label for="exampleInputEmail1">邮箱</label>
        <input type="email" class="form-control" name="email" placeholder="Email">
    </div>


    <div class="form-group">
        <label for="exampleInputPassword1">密码</label>
        <input type="password" class="form-control" name="pwd" placeholder="Password">
    </div>

    <div class="form-group">
        <label for="exampleInputPassword1">用户名</label>
        <input type="text" class="form-control" name="name" placeholder="用户名">
    </div>


    <div class="form-group">
        <label for="exampleInputPassword1"></label>手机号</label>
        <input type="text" class="form-control" name="tel" placeholder="手机号">
    </div>


    <div class="form-group">
        <label for="exampleInputPassword1">地址</label>
        <input type="text" class="form-control" name="Address" id="D" placeholder="地址" onblur="fun()">
        <div id="allmap"></div>
    </div>



    <div class="form-group">
        <label for="exampleInputFile">图片</label>
        <input type="file" name="photos">
        <p class="help-block">Example block-level help text here.</p>
    </div>
    <div class="checkbox">
        <label>
            <input type="checkbox"> Check me out
        </label>
    </div>
    <button type="submit" class="btn btn-default">注册</button>
</form>

<script type="text/javascript">
    function fun() {
        var Address = $("#D").val();

        $.ajax({
            type: 'GET',
            url: 'http://week2.wenyuxiang.com/week-map',
            data: {
                Address: Address
            },
            
            success: function(res) {

                // alert( res.lng);
                // 百度地图API功能
                var map = new BMap.Map("allmap"); // 创建Map实例
                map.centerAndZoom(new BMap.Point(res.lng, res.lat), 11); // 初始化地图,设置中心点坐标和地图级别
                //添加地图类型控件
                map.addControl(new BMap.MapTypeControl({
                    mapTypes: [
                        BMAP_NORMAL_MAP,
                        BMAP_HYBRID_MAP
                    ]
                }));
                map.setCurrentCity("北京"); // 设置地图显示的城市 此项是必须设置的
                map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
            }

        })


    }
</script>